package com.woniuxy.joylife.manager.controller;

import com.woniuxy.joylife.manager.entity.MeetingEntity;
import com.woniuxy.joylife.manager.service.MeetingService;
import com.woniuxy.joylife.manager.utils.PageUtils;
import com.woniuxy.joylife.manager.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 会议信息
 *
 * @author renxiang
 * @email 981405195@qq.com
 * @date 2020-05-13 02:47:54
 */
@RestController
@RequestMapping("manager/meeting")
public class MeetingController {
    @Autowired
    private MeetingService meetingService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("manager:meeting:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = meetingService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{meetId}")
    //@RequiresPermissions("manager:meeting:info")
    public R info(@PathVariable("meetId") String meetId){
		MeetingEntity meeting = meetingService.getById(meetId);

        return R.ok().put("meeting", meeting);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("manager:meeting:save")
    public R save(@RequestBody MeetingEntity meeting){
		meetingService.save(meeting);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("manager:meeting:update")
    public R update(@RequestBody MeetingEntity meeting){
		meetingService.updateById(meeting);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("manager:meeting:delete")
    public R delete(@RequestBody String[] meetIds){
		meetingService.removeByIds(Arrays.asList(meetIds));

        return R.ok();
    }

}
